home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_065
/
cookie
/
cookie.doc
< prev
next >
Wrap
Text File
|
1992-05-06
|
3KB
|
64 lines
"Cookie" - The Fortune Cookie Program
User's and Developer's Guide
Copyright (C) 1987, Richard P. Stevens, II and
Small Scale Systems of Southern California (4SC)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"COOKIE" is a fun program. Used primarily as an amusement, Cookie will produce
a daily (hourly, minutely?) dose of wisdom and sage advice.
The program is provided to the public domain by the author of both the program
and this guide, Rick Stevens.
The executable program image, "Cookie", may reside in any directory. The
data file, "Cookie.Dat", must reside in the ":devs/" directory -- that is
the current disk, in the "DEVS" directory.
[Ed note: I've modified the program to use the logical assign COOKIE: so
you can just assign COOKIE: to whatever directory the cookie.dat file
is in. Fred Fish, 4-Apr-87]
The program will compute a random number, using a seed value of the second
longword returned by the "DateStamp()" function in AmigaDOS. This random
number (returned as a longword), is then divided by the length of the
"Cookie.Dat" file (returned by the AmigaDOS "LIST" command) in bytes (used
as a compile-time constant).
The resultant value is then used to seek to a random spot in that data file.
The data file is read until an ASCII "form feed" character is read (a
hexadecimal value of "0x0C"). This signifies the beginning of a fortune.
The file is then read into another buffer, up to the next form feed character.
The form feed character is replaced by a NULL, and the fortune is printed to
the screen.
If, at any time during the above operations, a file error occurs, a new random
number is generated and the process repeats. A CONTROL-C or CONTROL-D character
from the keyboard will abort the program at any time.
The structure of the "Cookie.Dat" file is as follows:
A form feed character is the first character.
2. A string of ASCII characters which form the text of the
fortune. The text may span multiple lines.
3. A form feed character terminates the fortune.
The file, as distributed, was downloaded from a VAX-11/750 computer from
Digital Equipment Corporation. The origins of the file are unknown to the
author, but probably came from the DEC Users Society (DECUS).
The fortunes are in alphabetical order, but that is not necessary.
The author hopes that you will enjoy this program. Feedback is quite welcome.
Address your letters to:
Rick Stevens
Small Scale Systems of Southern California (4SC)
10447-1 Larwin Avenue
Chatsworth, CA 91311
(818) 882-2015